﻿namespace BM.Tools.WebControls.MForm.Controls.Validators
{
    using Items;

    using Resources;

    /// <summary>
    /// A class that keeps data about validation error caused by a choice item that had no item selected.
    /// </summary>
    public class NotSelectedChoiceItemErrorCause : ErrorCause
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="NotSelectedChoiceItemErrorCause"/> class.
        /// </summary>
        /// <param name="errorControl">
        /// The error control.
        /// </param>
        public NotSelectedChoiceItemErrorCause(ChoiceItem errorControl) : base(errorControl)
        {
        }

        /// <summary>
        /// Gets ErrorControl.
        /// </summary>
        public new OffspringItem ErrorControl
        {
            get
            {
                return base.ErrorControl as ChoiceItem;
            }
        }

        /// <summary>
        /// Gets the message that should be displayed when this error ocurred - an information about no selected item.
        /// </summary>
        protected override string ErrorMessage
        {
            get
            {
                return MessageResource.NoItemSelected;
            }
        }

        /// <summary>
        /// Gets the name of the error control
        /// </summary>
        protected override string ErrorControlName
        {
            get
            {
                return ErrorControl.DisplayName;
            }
        }
    }
}
